$(window).on("load", function() {
    $("#preloader").delay(750).fadeOut("slow")
});
$(document).ready(function() {
    $(".post-carousel-lg").slick({
        dots: true,
        arrows: true,
        slidesToShow: 1,
        slidesToScroll: 1,
        fade: true,
        cssEase: "linear",
        responsive: [{
            breakpoint: 768,
            settings: {
                slidesToShow: 1,
                slidesToScroll: 1,
                dots: true,
                arrows: false,
            }
        }]
    });
    $(".post-carousel-featured").slick({
        dots: true,
        arrows: false,
        slidesToShow: 5,
        slidesToScroll: 2,
        responsive: [{
            breakpoint: 1440,
            settings: {
                slidesToShow: 4,
                slidesToScroll: 4,
                dots: true,
                arrows: false,
            }
        }, {
            breakpoint: 1024,
            settings: {
                slidesToShow: 3,
                slidesToScroll: 3,
                dots: true,
                arrows: false,
            }
        }, {
            breakpoint: 768,
            settings: {
                slidesToShow: 2,
                slidesToScroll: 2,
                dots: true,
                arrows: false,
            }
        }, {
            breakpoint: 576,
            settings: {
                slidesToShow: 1,
                slidesToScroll: 1,
                dots: true,
                arrows: false,
            }
        }]
    });
    $(".post-carousel-twoCol").slick({
        dots: false,
        arrows: false,
        slidesToShow: 2,
        slidesToScroll: 1,
        responsive: [{
            breakpoint: 768,
            settings: {
                slidesToShow: 2,
                slidesToScroll: 2,
                dots: false,
                arrows: false,
            }
        }, {
            breakpoint: 576,
            settings: {
                slidesToShow: 1,
                slidesToScroll: 1,
                dots: false,
                arrows: false,
            }
        }]
    });
    $(".carousel-topNav-prev").click(function() {
        $(".post-carousel-twoCol").slick("slickPrev")
    });
    $(".carousel-topNav-next").click(function() {
        $(".post-carousel-twoCol").slick("slickNext")
    });
    $(".post-carousel-widget").slick({
        dots: false,
        arrows: false,
        slidesToShow: 1,
        slidesToScroll: 1,
        responsive: [{
            breakpoint: 991,
            settings: {
                slidesToShow: 2,
                slidesToScroll: 1,
            }
        }, {
            breakpoint: 576,
            settings: {
                slidesToShow: 1,
                centerMode: true,
                slidesToScroll: 1,
            }
        }]
    });
    $(".carousel-botNav-prev").click(function() {
        $(".post-carousel-widget").slick("slickPrev")
    });
    $(".carousel-botNav-next").click(function() {
        $(".post-carousel-widget").slick("slickNext")
    });
    var b = $(".header-default, .header-personal nav, .header-classic .header-bottom"),
        a = b.before(b.clone().addClass("clone"));
    $(window).on("scroll", function() {
        var c = $(window).scrollTop();
        $("body").toggleClass("down", (c > 300))
    })
});
$(function() {
    $(".sidebar").stickySidebar({
        topSpacing: 60,
        bottomSpacing: 30,
        containerSelector: ".main-content",
    });
    $(".submenu").before('<i class="icon-arrow-down switch"></i>');
    $(".vertical-menu li i.switch").on("click", function() {
        var e = $(this).next(".submenu");
        e.slideToggle(300);
        e.parent().toggleClass("openmenu")
    });
    $("button.burger-menu").on("click", function() {
        $(".canvas-menu").toggleClass("open");
        $(".main-overlay").toggleClass("active")
    });
    $(".canvas-menu .btn-close, .main-overlay").on("click", function() {
        $(".canvas-menu").removeClass("open");
        $(".main-overlay").removeClass("active")
    });
    $("button.search").on("click", function() {
        alert(1)
        $(".search-popup").addClass("visible")
    });
    $(".search-popup .btn-close").on("click", function() {
        $(".search-popup").removeClass("visible")
    });
    $(document).keyup(function(f) {
        if (f.key === "Escape") {
            $(".search-popup").removeClass("visible")
        }
    });
    $('button[data-bs-toggle="tab"]').on("click", function() {
        $(".tab-pane").addClass("loading");
        $(".lds-dual-ring").addClass("loading");
        setTimeout(function() {
            $(".tab-pane").removeClass("loading");
            $(".lds-dual-ring").removeClass("loading")
        }, 500)
    });
    $(".post button.toggle-button").each(function() {
        $(this).on("click", function(f) {
            $(this).next(".social-share .icons").toggleClass("visible");
            $(this).toggleClass("icon-close").toggleClass("icon-share")
        })
    });
    var c = document.getElementsByClassName("spacer");
    for (var b = 0; b < c.length; b++) {
        var d = c[b].getAttribute("data-height");
        c[b].style.height = "" + d + "px"
    }
    var c = document.getElementsByClassName("data-bg-image");
    for (var b = 0; b < c.length; b++) {
        var a = c[b].getAttribute("data-bg-image");
        c[b].style.backgroundImage = "url('" + a + "')"
    }
});